<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!-- Copyright 1997 The Open Group, All Rights Reserved -->
<title>pthread_rwlock_unlock</title>
</head><body bgcolor=white>
<center>
<font size=2>
The Single UNIX &reg; Specification, Version 2<br>
Copyright &copy; 1997 The Open Group

</font></center><hr size=2 noshade>
<h4><a name = "tag_000_007_1621">&nbsp;</a>NAME</h4><blockquote>
pthread_rwlock_unlock - unlock a read-write lock object
</blockquote><h4><a name = "tag_000_007_1622">&nbsp;</a>SYNOPSIS</h4><blockquote>
<pre><code>

#include &lt;<a href="pthread.h.html">pthread.h</a>&gt;

int pthread_rwlock_unlock(pthread_rwlock_t <i>*rwlock</i>);
</code>
</pre>
</blockquote><h4><a name = "tag_000_007_1623">&nbsp;</a>DESCRIPTION</h4><blockquote>
The
<i>pthread_rwlock_unlock()</i>
function is called to release a lock held on the read-write lock
object referenced by <i>rwlock</i>.
Results are undefined if the read-write lock <i>rwlock</i> is not
held by the calling thread.
<p>
If this function is called to release a read lock from the
read-write lock object and there are other read locks
currently held on this read-write lock object, the read-write
lock object remains in the read locked state.
If this function releases the calling thread's last read lock on this
read-write lock object, then the calling thread is no longer one of
the owners of the object.
If this function releases the last read lock for this read-write lock
object, the read-write lock object will be put in the unlocked state
with no owners.
<p>
If this function is called to release a write lock for this
read-write lock object, the read-write lock object will
be put in the unlocked state with no owners.
<p>
If the call to the 
<i>pthread_rwlock_unlock()</i>
function results in
the read-write lock object becoming unlocked
and there are multiple threads waiting to acquire the read-write
lock object for writing, the scheduling policy
is used to determine which thread acquires the read-write
lock object for writing. If there are multiple
threads waiting to acquire the read-write lock object for reading,
the scheduling policy is used to determine
the order in which the waiting threads acquire the
read-write lock object for reading. 
If there are multiple threads blocked on <i>rwlock</i>
for both read locks and write locks, it is
unspecified whether the readers acquire the lock first or whether
a writer acquires the lock first.
<p>
Results are undefined if any of these functions are called with
an uninitialised read-write lock.
</blockquote><h4><a name = "tag_000_007_1624">&nbsp;</a>RETURN VALUE</h4><blockquote>
If successful, the 
<i>pthread_rwlock_unlock()</i>
function returns zero.
Otherwise, an error number is returned
to indicate the error.
</blockquote><h4><a name = "tag_000_007_1625">&nbsp;</a>ERRORS</h4><blockquote>
The
<i>pthread_rwlock_unlock()</i>
function may fail if:
<dl compact>

<dt>[EINVAL]<dd>
The value specified by <i>rwlock</i> does not refer to an initialised
read-write lock object.

<dt>[EPERM]<dd>
The current thread does not own the read-write lock.

</dl>
</blockquote><h4><a name = "tag_000_007_1626">&nbsp;</a>EXAMPLES</h4><blockquote>
None.
</blockquote><h4><a name = "tag_000_007_1627">&nbsp;</a>APPLICATION USAGE</h4><blockquote>
Similar functions are being developed by IEEE PASC.
In keeping with its objective of ensuring that CAE
Specifications are fully aligned with formal standards, The Open Group
intends to add any new interfaces adopted by an official IEEE standard
in this area.
</blockquote><h4><a name = "tag_000_007_1628">&nbsp;</a>FUTURE DIRECTIONS</h4><blockquote>
None.
</blockquote><h4><a name = "tag_000_007_1629">&nbsp;</a>SEE ALSO</h4><blockquote>
<i><a href="pthread.h.html">&lt;pthread.h&gt;</a></i>,
<i><a href="pthread_rwlock_init.html">pthread_rwlock_init()</a></i>,
<i><a href="pthread_rwlock_wrlock.html">pthread_rwlock_wrlock()</a></i>,
<i><a href="pthread_rwlockattr_init.html">pthread_rwlockattr_init()</a></i>,
<i><a href="pthread_rwlock_rdlock.html">pthread_rwlock_rdlock()</a></i>.
</blockquote><hr size=2 noshade>
<center><font size=2>
UNIX &reg; is a registered Trademark of The Open Group.<br>
Copyright &copy; 1997 The Open Group
<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]

</font></center><hr size=2 noshade>
</body></html>
